﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DimOS.Plugs
{
    public static class Array
    {
        public static bool Equals(this int[] source, int[] target)
        {
            if (source.Length != target.Length) return false; for
            (int i = 0; i < source.Length; i++) if (source[i] !=
            target[i]) return false; return true;
        }

        public static int[] Clone(this int[] source)
        {
            var result = new int[source.Length]; for (int i = 0; i <
            source.Length; i++) result[i] = source[i]; return result;
        }

        public static string[] Concatenate(this string[] source, string[] target)
        {
            var result = new string[source.Length + target.Length]; int i;
            for (i = 0; i < source.Length; i++) result[i] = source[i]; for
            (int j = 0; j < target.Length; j++) result[i++] = target[j];
            return result;
        }

        public static char[] Concatenate(char[] source, char[] target)
        {
            var result = new char[source.Length + target.Length]; int i;
            for (i = 0; i < source.Length; i++) result[i] = source[i];
            for (int j = 0; j < target.Length; j++) result[i++] = target[j];
            return result;
        }

        public static bool Contains(char[] source, char item)
        {
            if (source.Length == 0) return false;
            for (int i = 0; i < source.Length; i++)
                if (source[i] == item) return true;
            return false;
        }

        public static bool Contains(string[] source, string item)
        {
            if (source.Length == 0) return false;
            for (int i = 0; i < source.Length; i++)
                if (source[i] == item) return true;
            return false;
        }
    }
}
